package ar.com.PanteraRosa;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import ar.com.PanteraRosa.Business.UserController;
import ar.com.PanteraRosa.Common.Conf;

public class HomeUserActivity extends Activity {
    public UserController userController;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
		if (Conf.getInstance().isLogged()) {
		    super.onCreate(savedInstanceState);
		    setContentView(R.layout.homeuser);
		    setTitle(R.string.app_name);
		    this.userController = new UserController(this);
	
		    String userNick = Conf.getInstance().getUser().getUserNick();
		    // TODO mostrar la home con los datos
		    // ((EditText)findViewById(R.id.textViewUserNick)).setText(userNick);
		}
    }
    

    /**
     * 
     * @param vista
     */
    public void btnMyProfile_OnClick(View vista) {
		if (Conf.getInstance().isLogged()) {
		    Intent intent = new Intent();
		    intent.setClass(this, MyProfileUserActivity.class);
		    startActivity(intent);
			}
    }

    public void btnMyContacts_OnClick(View vista) {
		if (Conf.getInstance().isLogged()) {
		    Intent intent = new Intent();
		    intent.setClass(this, MyContactsUserActivity.class);
		    startActivity(intent);
			}
    }

    public void btnUpdateAddressBook_OnClick(View vista) {

    }

    /**
     * 
     * @param vista
     */
    public void btnLogout_OnClick(View vista) {
    	this.userController.logOut();
    	Intent intent = new Intent();
    	intent.setClass(this, LoginUserActivity.class);
    	startActivity(intent);
    }

}
